Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #13522 FP knownConditionTrueFalse after unsigned-to-signed conversion #7179

Merged
merged 1 commit into from
Feb 23, 2025

Conversation

chrchr-github
Copy link
Collaborator

No description provided.

@chrchr-github
Copy link
Collaborator Author

@pfultz2 Any thoughts?

Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it's a false positive however if the fix is correct, I don't know..

@@ -527,6 +527,8 @@ struct ValueFlowAnalyzer : Analyzer {
continue;
if (exact && v.intvalue != 0 && !isPoint)
continue;
if (astIsUnsigned(tok) != astIsUnsigned(v.tokvalue))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, it is a little too restrictive which could lead to FNs, but it will fix FPs. To fix FNs, we would need to check if the value is within the range of an unsigned value. I am not sure how to write a test case to demonstrate it though as most known values will be passed through with the afterAssign passes anyways. Need to think about it some more.

Copy link
Collaborator Author

@chrchr-github chrchr-github Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 We could also wait until after the next release, so we can see the effects in daca.

@firewave firewave added the merge-after-next-release Wait with merging this PR until after the next Release label Jan 28, 2025
@chrchr-github chrchr-github merged commit 80047b5 into danmar:main Feb 23, 2025
60 checks passed
@chrchr-github chrchr-github deleted the chr_13522 branch February 23, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-after-next-release Wait with merging this PR until after the next Release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants